﻿namespace EFS.RC.CC.Srv
{
	public partial class Service : System.ServiceProcess.ServiceBase
	{
		public Service()
		{
			InitializeComponent();
		}

		protected override void OnStart(string[] args)
		{
			// set log async
			EFS.EventLog.Log.StartAsyncLogger(true);

			// CHL
			EFS.RC.CC.SAL.Loggers.Logger.Instance.StartWritter();

			// start RTL log
			EFS.RC.CC.CHL.Loggers.Logger.Instance.StartWritter();

			// asink start
			EFS.RC.CC.Platform.Start();
		}

		protected override void OnStop()
		{
			// asink stop
			EFS.Common.Async.AsyncProcess apStop = EFS.RC.CC.Platform.Stop();

			// wait
			apStop.WaitComplete();

			// stop RTL log
			EFS.RC.CC.CHL.Loggers.Logger.Instance.StopWritter();

			// stop CHL log
			EFS.RC.CC.SAL.Loggers.Logger.Instance.StopWritter();

			// stop log writter is async
			// set log async
			EFS.EventLog.Log.StopAsyncLogger();
		}
	}
}
